package com.yanqu.road.server.manger.activity.auto.send;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.UnionActivityConditionData;
import com.yanqu.road.entity.activity.UserActivityConditionData;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.logic.bussiness.player.UserActivityBussiness;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ：zfr
 * @date ：2021/8/10 14:20
 */
public class CrossUnionActivityAutoSend extends BaseAutoSendActivity {

    public CrossUnionActivityAutoSend(ActivityInfo activityInfo) {
        super(activityInfo);
    }

    @Override
    public void sendLocalUserRankReward() {

    }

    @Override
    public void sendLocalUnionRankReward() {

    }

    @Override
    protected boolean updateConditionData(UserActivityConditionData data) {
        return UserActivityBussiness.updateUserActivityConditionData(data);
    }

    @Override
    public void sendConditionReward() {

    }

    @Override
    public List<UserActivityConditionData> getNeedSendUserActivityConditionData() {
        Map<Long, UserActivityConditionData> unionActivityUserConditionDataMap = UserActivityBussiness.getUnionActivityUserConditionDataMap(activityInfo.getActivityId());
        return unionActivityUserConditionDataMap.values().stream().filter(data -> !data.isGetReward()).collect(Collectors.toList());
    }

    @Override
    public Map<String, UnionActivityConditionData> getUnionActivityConditionData(int conditionType) {
        return UserActivityBussiness.getUnionActivityConditionDataMap(activityInfo.getActivityId());
    }

    @Override
    public Map<Long, UserActivityConditionData> getUserActivityRankConditionData(int activityId, int conditionType) {
        return UserActivityBussiness.getUnionActivityUserConditionDataMap(activityId);
    }

    @Override
    public void noticeCrossUnionRank() {
        List<String> typeList = new ArrayList<>();
        typeList.add(String.valueOf(eGamePlayerEventType.UnionExpRiseRank.getValue()));
        noticeCrossUnionYRank(typeList);
    }
}
